//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.ObjectModel;
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public class PresetTextShape : IOfficeXmlSerializable
    {
        private TextShapeType _prst;

        private ObservableCollection<GeometryGuide> avLst;

        public TextShapeType PresetShapeType
        {
            get { return _prst; }
            set { _prst = value; }
        }

        public ObservableCollection<GeometryGuide> AdjustValueList
        {
            get
            {
                if (avLst == null)
                    avLst = new ObservableCollection<GeometryGuide>();
                return avLst;
            }
            set { avLst = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.Read("prstTxWarp"))
            {
                PresetShapeType = c.GetEnum<TextShapeType>("prst");
                avLst = c.ReadOptionalCollection<GeometryGuide>("avLst", "gd");
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("prstTxWarp"))
            {
                c.SetEnum("prst", PresetShapeType);
                c.WriteOptionalElementList(avLst, "avLst");
            }
        }

        #endregion
    }
}